<?php 
require('config.php');
echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>Thrissa's Quick Character Info</title>
		<script type="text/javascript" src="js/custom_stats.js"></script>
		<script type="text/javascript" src="js/prototype.js"></script>
		<script type="text/javascript" src="js/autocomplete.js"></script>
		<script type="text/javascript">
		<!--
			var server;
			var player;
			var region = "US";
			var style;
			var selectedtab = "";
			var http;
			var basedomain = "<? echo BASE_DOMAIN; ?>/";
			var domain = "<? echo BASE_DOMAIN; echo (ENABLE_CORALCDN)?'.nyud.net:8080':'';?>/";
			var ajax;
			
			function Loaded() {
				new Autocomplete('fserver', 'suggestions');
				$('step1').onsubmit = step1Submit;
				// preload
				var loading = new Image();
				loading.src = 'assets/loading.gif';
			}
			
			function step1Submit() {
				player = $('fcharacter').value;
				server = $('fserver').value;
				region = (($('fregionEU').checked == true) ? $('fregionEU').value : $('fregionUS').value);
				if (server == '') {
					$('fserver').focus();
					return false;
				} else if (player == '') {
					$('fcharacter').focus();
					return false;
				}
				// start a request
				requestData();
				return false; // stop form submission
			}
			function requestData() {
				$('loading').style.display = 'inline';
				var params = 'z='+region+'&n='+player+'&r='+server;
				ajax = new Ajax.Request(
					"chardata.php",
					{
						onSuccess: recieveData,
						method: 'get',
						parameters: params,
						onFailure: function(){$('char').innerHTML = "Failed to load Character Data...<br />Try again, or report the problem."}
					}
				);
			}
			function recieveData(transport) {
				var data = transport.responseText || "Failed to load Character Data...<br />Try again, or report the problem.";
				$('loading').style.display = 'none';
				$('char').innerHTML = data;
				return false;
			}
		//-->
		</script>
		<link href="siggen.css" rel="stylesheet" type="text/css" />
	</head>
	<body onload="Loaded()">
		<h1>Thrissa's Quick Character Info</h1>
		<p>I've often asked what professions someone is, what spec they are. And sure, you could ask them, or go to the armory page. But I find the armory to be a little slow for my needs. So I wrote this page, the quick char info page. Think of it as the Thottbot for players. I'll be keeping it open, just to see who someone is before I invite them to a group :). Privacy who?</p>
		<div id="serverchar"><h2>Server and Character name</h2>
			<form id="step1" name="step1" action="#" method="GET">
				<div class="slabel">Region:</div>
				<div class="sinput"><input type="radio" id='fregionUS' name='fregion' value='us' checked='checked' /><label for="fregionUS">US</label> <input type="radio" id='fregionEU' name="fregion" value="eu" /><label for="fregionEU">Europe</label></div>
				
				<div class="slabel">Server:</div>
				<div class="sinput"><input type='text' id='fserver' name='server' value='' /></div>
				<div id="suggestions"></div>
				
				<div class="slabel" style="clear: both">Character:</div>
				<div class="sinput"><input type='text' id='fcharacter' name='character' value='' /></div>
			
				<div class="slabel"><img src="assets/loading.gif" id="loading" style="display:none" />&nbsp;</div>
				<input type="submit" value="Quick Lookup" />
			</form>
		</div>
		<div id='char'>
			
		</div>
	</body>
</html>